package platform.util;

import org.apache.log4j.Logger;

public class StringUtil {
	private static final Logger log = Logger.getLogger(StringUtil.class);
	/**
	 * <br/>方法描述:只获取类名
	 * @param c 
	 * @return  类名
	 */
	public  static String getSimpleClsName(Class c)
	{
		String name = c.getName();
		if(name.indexOf("$$")!=-1){
			name = name.substring(0,name.indexOf("$$"));
		}
		name = name.substring(name.lastIndexOf(".")+1);
		return name;
	}

	/**
	 * <br/>方法描述:统计字符串中某个字符的个数
	 * 
	 * @param s 要统计的字符串
	 * @param separator 统计的指定的字符
	 */
	public static int count(String s, char separator) {
	    int count = 0;
	    if(s==null)return 0;
	     for (int i = 0; i < s.length(); i++) {
	         if (s.charAt(i)==separator)
	           count++;
	     }
	    return count;
	  }
}
